package net.lab1024.sa.admin.module.business.record.controller;

import net.lab1024.sa.admin.module.business.record.domain.form.RecordAddForm;
import net.lab1024.sa.admin.module.business.record.domain.form.RecordQueryForm;
import net.lab1024.sa.admin.module.business.record.domain.form.RecordUpdateForm;
import net.lab1024.sa.admin.module.business.record.domain.vo.RecordVO;
import net.lab1024.sa.admin.module.business.record.service.RecordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 提现 Controller
 *
 * @Author syf
 * @Date 2025-05-29 11:07:16
 * @Copyright 畅想科技
 */

@RestController
@Tag(name = "")
public class RecordController {

    @Resource
    private RecordService recordService;

    @Operation(summary = "分页查询 @author syf")
    @PostMapping("/record/queryPage")
    public ResponseDTO<PageResult<RecordVO>> queryPage(@RequestBody @Valid RecordQueryForm queryForm) {
        return ResponseDTO.ok(recordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author syf")
    @PostMapping("/record/add")
    public ResponseDTO<String> add(@RequestBody @Valid RecordAddForm addForm) {
        return recordService.add(addForm);
    }

    @Operation(summary = "更新 @author syf")
    @PostMapping("/record/update")
    public ResponseDTO<String> update(@RequestBody @Valid RecordUpdateForm updateForm) {
        return recordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author syf")
    @PostMapping("/record/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return recordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/record/delete/{recordId}")
    public ResponseDTO<String> batchDelete(@PathVariable Long recordId) {
        return recordService.delete(recordId);
    }
}
